Repository navigation
The org's pull requests in one answer: GET /api/prs/overview - #988
Conversation
Every pull request in the team's repositories counts, people's, CoderHelm's and other bots'; CoderHelm's are one slice. Computed facts only, with thresholds from the scope's own percentiles, no rate on fewer than 10 events, and what isn't stored yet named in `missing`. No per-person ranking, count or duration; a login appears only as one item's owner. The summary's numbers are all facts. GET /api/prs takes the overview's drill-down (stage, past p85/p95). Incident case xz pins it.
…e numbers The stability line says "over the last month" so every number in the summary is a fact; the incident case reads the route's source without whitespace, so formatting can't hide a read.
… at once (#986) A run stopped because the change it built on closed now goes back to waiting as soon as GitHub reports the change reopened, not at the 15-minute sweep. The pull request handler sends the team's change check for a close or a reopen before any return a reopen reaches, naming the change, and the worker reads the runs that change's close stopped (the sweep stays the backstop for every team). A recovery posted after an alert route's quiet window now closes the run waiting on a person for that alert, through the same path a recovery posted at once uses (common::run_wake::alert_cleared, which the gateway's alert_delivery now calls too). Incident case xx_waits_never_outlive_their_event.
| lines: &lines, | ||
| merged_w: &merged_w, | ||
| merged_prev: &merged_prev, | ||
| merges_range: range8(i.snaps, now, |s| s.merges), |
There was a problem hiding this comment.
💬 FYI: Window merge count is compared with a 7-day snapshot range (correctness, not verified)
merges_range: range8(i.snaps, now, |s| s.merges) takes the 8 weekly values of Snapshot.merges, which pr_history.rs:349-351 documents as "In the 7 days to the snapshot". The summary compares that range with merged_w.len(), which covers the whole window_days (7, 14 or 28). With window=14d or 28d the count is about 2 or 4 times the weekly range. The merges_out test (about line 1685) then never fires, and the sentence reads "N merged (usual lo to hi)" with N over 14 or 28 days against a 7-day range. The verdict and the printed fact are misleading for non-default windows. merges_median and the quiet_week test (about line 1683) have the same mismatch.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
| .filter(|h| { | ||
| h.reverted_by | ||
| .as_ref() | ||
| .is_some_and(|(_, _, t)| *t > now - 14 * DAY) |
There was a problem hiding this comment.
💬 FYI: "Reverts this window" is capped at 14 days (correctness, not verified)
reverted_14 keeps only reverts with t > now - 14 * DAY. The summary's stability line and the Reverts tile filter it again with t > c.since and label the result "this window". For window=28d, reverts from days 15 to 28 are dropped, so the count is understated. Reverting part of the change isn't shown to fix the check: the failing test doesn't pass on the base branch's head. Build the revert list from max(window, 14d) and filter by since where the label says "window".
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
| let quiet = ro.is_empty() && arrivals == 0 && rm.is_empty(); | ||
| let past_range = range8(snaps, now, |s| s.past_p85); | ||
| let merges_range = range8(snaps, now, |s| s.merges); | ||
| let obligation = sec.iter().any(|(s, _)| *s == "critical") || bypass_unreviewed > 0; |
There was a problem hiding this comment.
💬 FYI: Repo health and flags mishandle kev and moderate severity (correctness, not verified)
Sla::days, the open-severity buckets and sev_rank all treat "kev" as critical and "moderate" as medium. The repo row does not. obligation checks *s == "critical" (line 872) and worst (lines 860-864) falls back to "low" for anything outside critical/high/medium. A kev fix past its 7-day SLA therefore makes the org verdict "Slipping" (sev_rank == 0) while its repo shows "healthy", or is flagged "low past SLA". A moderate fix is also labeled "low". Normalise the severity once, for example with the bucket mapping at lines 1285-1290, and use it for worst, obligation and the flags.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
| if past.is_some() && limit_secs.is_none() { | ||
| sources.push(json!({"name": "percentiles", "read": "held", "detail": "no percentiles yet, so every open pull request is shown"})); | ||
| } | ||
| let picked: Vec<pr_view::Row> = rows |
There was a problem hiding this comment.
💬 FYI: past= drill-down doesn't use the percentile the overview counts with (correctness, not verified)
The overview counts "past usual" with past_p85 in pr_overview.rs (~356). That uses Lines from scope_lines, which recomputes percentiles from history: a repo's own after 30 merges, else the org's. The past= filter here (past_secs, ~675) reads the newest snapshot of q.repo or q.org and takes its pct.cycle. Three results follow. (1) A repo under 30 merges is measured against the org line by the overview but against the repo's own snapshot line here, so the drilled rows can differ from the count. (2) With neither org nor repo on the list query, past_secs returns None, and the code then returns every open PR with only a sources note. The overview always sets an org scope (it infers one from the first open PR), so its count is for one org while the drill returns all of them. (3) A scope with no snapshot in the last 3 days also shows every open PR. In each case the list under a "past p85: N" link shows a different set than N. This is the main use of the new filter.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
| if let Some(r) = &repo { | ||
| super::reviewer::validate_repo(r)?; | ||
| } | ||
| let days = |
There was a problem hiding this comment.
💬 FYI: Near-identical helpers added together (scope, not verified)
services/gateway/src/routes/prs_overview.rs adds day next to day_of (in services/common/src/pr_overview.rs), added in the same change. Keep one helper with the shared logic (a parameter for what differs) and call it from both places. If the ticket truly needs it, say why on a line Wider than the ticket: services/gateway/src/routes/prs_overview.rs: <why>.
FYI, not a block: on the whole picture this is not a named correctness, security or data-loss problem to hold the merge on.
|
|
… gates and the new pull requests view (#985) * Every open pull request has a record and one state, read by the merge gates and the new pull requests view A durable record per open pull request in the team's connected repositories, written from the webhooks already received for every author and kept honest by a bounded GraphQL sync under the shared GitHub budget (sweep:dashboard_prs). One function (pr_needs::decide) decides each pull request's state, its turn and what it needs next from whom; the run's watch stores its standing and the reviewer's auto-merge gate merges only what it calls ready. GET /api/prs and GET /api/prs/detail serve the dashboard's pull requests page under the "view" capability. Incident case xw holds it. * Format the pull requests route * Keep each pull request's history, change log and nightly percentiles for the org overview Every duration starts at ready for review, and human review leaves out the author and every bot. Records keep their state and turn change log, people's reviews and review requests, and check transitions. A merged or closed pull request leaves a history row kept 400 days with its run and session links and revert and follow-up links. A nightly job writes each org's and repository's snapshot and percentiles, team-scoped and bounded. * Every pull request, whoever wrote it: history backfill and health signals A resumable 14-month backfill reads each organization's closed and merged pull requests into history under the shared budget, pausing on a held budget or rate limit and showing its progress per repository. Records keep separate author, reviewer and bot clocks, drift against the base, every check attempt (flaky reads as flaky), category and severity; history adds review coverage, bypass merges, suspect follow-ups with their reason, and CoderHelm's last run outcome and stop reason. * The org's pull requests in one answer: GET /api/prs/overview (#988) * The org's pull requests in one answer: GET /api/prs/overview Every pull request in the team's repositories counts, people's, CoderHelm's and other bots'; CoderHelm's are one slice. Computed facts only, with thresholds from the scope's own percentiles, no rate on fewer than 10 events, and what isn't stored yet named in `missing`. No per-person ranking, count or duration; a login appears only as one item's owner. The summary's numbers are all facts. GET /api/prs takes the overview's drill-down (stage, past p85/p95). Incident case xz pins it. * Overview: clippy's shapes, and words without hand-off phrases or loose numbers The stability line says "over the last month" so every number in the summary is a fact; the incident case reads the route's source without whitespace, so formatting can't hide a read. * A reopened change and a later alert recovery reach their waiting runs at once (#986) A run stopped because the change it built on closed now goes back to waiting as soon as GitHub reports the change reopened, not at the 15-minute sweep. The pull request handler sends the team's change check for a close or a reopen before any return a reopen reaches, naming the change, and the worker reads the runs that change's close stopped (the sweep stays the backstop for every team). A recovery posted after an alert route's quiet window now closes the run waiting on a person for that alert, through the same path a recovery posted at once uses (common::run_wake::alert_cleared, which the gateway's alert_delivery now calls too). Incident case xx_waits_never_outlive_their_event. * Answer the review: the gate never waits on what GitHub does not require, the sync never undoes events, history is never thinned The repository's approval rule is GitHub's own review decision and the team's rule is a person's approval; a review no rule requires is named, never a hold. The sync never reopens a closed record, yields to events newer than its read, replaces the reviews and requests it lists, and marks lists cut by their page size. History rows merge by source, so the backfill never thins a row written from events. The review decision is worked out at review events and used for bypass only when fresh. Stacks join within one repository, and the detail decides with the list's own linked records. * The sync writes each field only when its search was read after the last event that wrote it A page read before an event could undo that event's queue entry, auto-merge or review decision. Every field both events and the sync write (state, title, draft, head, base, labels, review requests, reviews, review decision, checks, mergeability, auto-merge, the merge queue, size) now keeps the time an event last wrote it, and the sync writes that field only when its read is newer. Tests cover a queue, an auto-merge and a review decision event landing after the read and surviving the page.
Summary
GET /api/prs/overview?org=&repo=&window=answers "what is the state of our pull requests" in one read. It is the summary layer above the per-PR list, and it counts every pull request in the team's repos: people's, CoderHelm's, Dependabot's and other bots'. CoderHelm's pull requests are one slice and appear only in its own section.It returns computed facts only:
What isn't stored yet comes back as
nulland is named inmissing, so nothing is faked.Builds on #985's storage (
pr_record,pr_history: history rows, snapshots, backfill progress) and imports its types.Changes
common/src/pr_overview.rs: the pure builder.Builder::num, so it is a fact infacts.gateway/src/routes/prs_overview.rs: the route, under "view".bm_teams_never_cross.gateway/src/routes/prs.rs:GET /api/prsgains the overview's drill-down filters,stage=andpast=p85|p95. Counts stay over the whole scope.read_allanditems_underbecomepub(crate).xz_org_overview_facts_only(.rs and .md). It pins five things:Verification
On the head, with main and #985's head merged in:
cargo fmt --all --checkandrustfmt --edition 2021 --check worker/src/passes/incidents/*.rspass.cargo clippy -p common -p worker -p gateway --all-targets -- -D warningspasses.cargo test -p common -p worker -p gateway: 7,741 passed, 0 failed, 31 ignored. The run includes the newxzcase,bm_teams_never_crosswith the new cache, and the ownership phrase scan.brand_spelling.py,domain_examples.pyandtext_guard.py(on this body and the commit messages) pass.What's real and what isn't yet
missing) until enough has been stored: week-over-week deltas and 8-week ranges, drift (10 merges), rubber-stamp by size (10 approvals), and, while the backfill runs, everything that needs history (with its progress).History.run_outcomeis never written yet);Stacked on #985 (base
pull-requests-view). The dashboard is CoderHelm/coderhelm#546.